<!DOCTYPE html>
<html lang="zh-CN">
<head>
    {% load static %}
    <meta charset="UTF-8">
    <title>登录</title>
    <style>
        :root {
            --primary-color: #ff6a00;
            --success-color: #52c41a;
            --text-dark: #1f2d3d;
            --text-light: #5e6c84;
        }
        .ant-container {
            min-height: 100vh;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 24px;
            background: url('{% static "images/beijing.jpg" %}') no-repeat center/cover;
        }
        .ant-card {
            background: rgba(255,255,255,0.95);
            padding: 48px;
            border-radius: 12px;
            box-shadow: 0 8px 24px rgba(0,0,0,0.08);
            max-width: 560px;
            width: 100%;
            transition: transform 0.3s;
        }
        .ant-title {
            color: var(--text-dark);
            font-size: 28px;
            margin-bottom: 32px;
            text-align: center;
            font-weight: 600;
        }
        .ant-form {
            display: flex;
            flex-direction: column;
            gap: 24px;
        }
        .form-group {
            position: relative;
        }
        .ant-label {
            display: block;
            margin-bottom: 8px;
            color: var(--text-dark);
            font-weight: 500;
        }
        .ant-input {
            width: 100%;
            padding: 12px 16px;
            border: 2px solid #e4e7ed;
            border-radius: 6px;
            font-size: 14px;
            transition: all 0.3s;
        }
        .ant-input:focus {
            border-color: var(--primary-color);
            box-shadow: 0 0 0 2px rgba(255,106,0,0.2);
        }
        .ant-btn {
            padding: 16px 32px;
            background: var(--primary-color);
            border: none;
            color: white;
            border-radius: 6px;
            font-size: 16px;
            font-weight: 500;
            position: relative;
            overflow: hidden;
            transition: all 0.3s;
            cursor: pointer;
        }
        .ant-btn:hover {
            background: #ff5500;
            transform: translateY(-1px);
            box-shadow: 0 4px 12px rgba(255,106,0,0.3);
        }
        .hover-effect {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(255,255,255,0.1);
            opacity: 0;
            transition: opacity 0.3s;
        }
        .ant-btn:hover .hover-effect {
            opacity: 1;
        }
        .form-footer {
            text-align: center;
            color: var(--text-light);
            margin-top: 16px;
        }
        .ant-link {
            color: var(--primary-color);
            text-decoration: none;
            font-weight: 500;
        }
        .ant-link:hover {
            text-decoration: underline;
        }
        .ant-alert {
            padding: 12px;
            border-radius: 6px;
            margin-bottom: 24px;
            text-align: center;
        }
        .ant-alert-error {
            background: #fff2f0;
            border: 1px solid #ffccc7;
            color: #ff4d4f;
        }
        .ant-alert-success {
            background: #f6ffed;
            border: 1px solid #b7eb8f;
            color: var(--success-color);
        }
        @media (max-width: 480px) {
            .ant-card {
                padding: 24px;
            }
            .ant-title {
                font-size: 24px;
            }
        }
    </style>
</head>
<body>
<div class="ant-container">
    <div class="ant-card">
        <h1 class="ant-title" style="font-size: 32px; margin-bottom: 24px;">基于问卷数据的可视化分析系统</h1>
            <h2 class="ant-title">欢迎登录</h2>
            {% if messages %}
                {% for message in messages %}
                    <div class="ant-alert {% if message.tags == 'success' %}ant-alert-success{% else %}ant-alert-error{% endif %}">
                        {{ message }}
                    </div>
                {% endfor %}
            {% endif %}
            {% if error %}
                <div class="ant-alert ant-alert-error">{{ error }}</div>
            {% endif %}
        <form method="post" class="ant-form">
            {% csrf_token %}
            <div class="form-group">
                <label for="username" class="ant-label">用户名</label>
                <input type="text" id="username" name="username" class="ant-input" required>
            </div>
            <div class="form-group">
                <label for="password" class="ant-label">密码</label>
                <input type="password" id="password" name="password" class="ant-input" required>
            </div>
            <button type="submit" class="ant-btn">
                立即登录
                <div class="hover-effect"></div>
            </button>
            <div class="form-footer">
                没有账户？<a href="{% url 'register' %}" class="ant-link">立即注册</a><br>
                <a href="{% url 'password_reset_request' %}" class="ant-link">忘记密码？</a>
            </div>
        </form>
    </div>
</div>
<script>
    // 自动隐藏提示
    document.addEventListener('DOMContentLoaded', function() {
        const alerts = document.querySelectorAll('.ant-alert');
        alerts.forEach(alert => {
            setTimeout(() => {
                alert.style.transition = 'opacity 0.5s';
                alert.style.opacity = '0';
                setTimeout(() => alert.remove(), 500);
            }, 3000); // 3秒后消失
        });
    });
</script>
</body>
</html>